/**
 * 
 */
package ufrj.safcp.modules.coleta;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.image.BufferedImage;
import java.text.NumberFormat;
import java.util.Hashtable;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JTextField;

import ufrj.safcp.controller.State;
import ufrj.safcp.view.SAFCPFrame;
import ufrj.safcp.view.components.ImagePanel;
import ufrj.safcp.view.resources.icons.Icons;


/**
 * @author Bruno
 *
 */
public class ColetaMainFrame extends SAFCPFrame {

	private static final String LER_CODIGO_DO_CARTAO = "Ler código do cartão";

	private static final long serialVersionUID = 1L;

	private JPanel mainContentPane = null;
	private JPanel headerPanel = null;
	private JLabel headerLabel = null;
	private JPanel leftPanel = null;
	private JSlider stepSlider = null;
	private JPanel digitalPanel = null;  //  @jve:decl-index=0:visual-constraint="565,641"
	private JPanel inscricaoPanel = null;  //  @jve:decl-index=0:visual-constraint="16,649"
	private JPanel etiquetaPanel = null;  //  @jve:decl-index=0:visual-constraint="93,1094"
	private ColetaController controller;
	private JLabel inscricaoHeaderLabel = null;
	private JButton lerCodigoButton = null;
	private JLabel digitalHeaderLabel = null;
	private JPanel digitaisPanel = null;
	private JCheckBox digital1CheckBox = null;
	private JCheckBox digital2CheckBox = null;
	private JCheckBox digital3CheckBox = null;
	private JTextField numeroLidoField = null;
	private JButton numeroLidoOkButton = null;
	private JLabel etiquetaHeaderLabel = null;
	private ImagePanel etiquetaImagemPanel;  //  @jve:decl-index=0:
	private JButton imprimirEtiquetaButton = null;
	private ImagePanel cameraPanel = null;
	private JLabel inscricaoNumberReadLabel = null;

	private ImagePanel digitalImagePanel = null;

	private JPanel fiscalPanel = null;  //  @jve:decl-index=0:visual-constraint="627,1128"

	private JLabel fiscalHeaderLabel = null;

	private JPanel digitaisFiscalPanel = null;

	private JCheckBox digitalFiscal1CheckBox = null;

	private ImagePanel digitalFiscalImagePanel = null;

	private JPanel aguardandoPanel = null;  //  @jve:decl-index=0:visual-constraint="93,1563"

	private JLabel aguardandoHeaderLabel = null;

	private JButton prosseguirButton = null;

	private JPanel rodapePanel = null;

	private JTextField fiscalIndentificadoTextField = null;

	private JLabel fiscalLabel = null;
	/**
	 * This method initializes 
	 * @param controller 
	 * 
	 */
	public ColetaMainFrame(ColetaController controller) {
		super();
		this.controller = controller;
		initialize();
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		center(this);
	}
	
	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() {
        this.setSize(new Dimension(800, 600));
        this.setContentPane(getMainContentPane());
        this.setTitle("SAFCP - Módulo Coletor");
			
	}

	/**
	 * This method initializes mainContentPane	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getMainContentPane() {
		if (mainContentPane == null) {
			BorderLayout borderLayout = new BorderLayout();
			borderLayout.setHgap(0);
			mainContentPane = new JPanel();
			mainContentPane.setLayout(borderLayout);
			mainContentPane.add(getHeaderPanel(), BorderLayout.NORTH);
			mainContentPane.add(getLeftPanel(), BorderLayout.WEST);
			mainContentPane.add(getRodapePanel(), BorderLayout.SOUTH);
		}
		return mainContentPane;
	}

	/**
	 * This method initializes headerPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getHeaderPanel() {
		if (headerPanel == null) {
			headerLabel = new JLabel();
			headerLabel.setText("SAFCP - Módulo de Identificação do Candidato");
			headerLabel.setFont(new Font(null, Font.BOLD, 24));
			headerPanel = new JPanel();
			headerPanel.setLayout(new GridBagLayout());
			headerPanel.add(headerLabel, new GridBagConstraints());
			headerPanel.setBorder(BorderFactory.createRaisedBevelBorder());
		}
		return headerPanel;
	}

	/**
	 * This method initializes leftPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getLeftPanel() {
		if (leftPanel == null) {
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints.insets = new Insets(5, 8, 5, 3);
			gridBagConstraints.weightx = 1.0;
			leftPanel = new JPanel();
			leftPanel.setLayout(new GridBagLayout());
			leftPanel.add(getStepSlider(), gridBagConstraints);
			leftPanel.setBorder(BorderFactory.createTitledBorder("Status"));
		}
		return leftPanel;
	}

	/**
	 * This method initializes stepSlider	
	 * 	
	 * @return javax.swing.JSlider	
	 */
	private JSlider getStepSlider() {
		if (stepSlider == null) {
			stepSlider = new JSlider();
			
			stepSlider.setOrientation(JSlider.VERTICAL);
			stepSlider.setInverted(true);
			stepSlider.setMinimum(1);
			stepSlider.setMaximum(controller.getAllStates().length);
			stepSlider.setValue(1);
			
			stepSlider.setPaintTrack(false);
			stepSlider.setPaintTicks(false);
			stepSlider.setPaintLabels(true);
			
			Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
			State[] allStates = controller.getAllStates();
			for (State state : allStates) {
				JLabel label = new JLabel(state.name);
				label.setFont(new Font("Arial", Font.BOLD, 14));
				labelTable.put(state.number, label);
			}
			stepSlider.setLabelTable(labelTable);
			
		}
		return stepSlider;
	}

	/**
	 * This method initializes centerPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getDigitalPanel() {
		if (digitalPanel == null) {
			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
			gridBagConstraints7.gridx = 0;
			gridBagConstraints7.insets = new Insets(8, 0, 8, 0);
			gridBagConstraints7.gridy = 0;
			GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
			gridBagConstraints13.gridx = -1;
			gridBagConstraints13.gridy = -1;
			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
			gridBagConstraints4.gridx = 0;
			gridBagConstraints4.insets = new Insets(12, 0, 12, 0);
			gridBagConstraints4.ipadx = 5;
			gridBagConstraints4.ipady = 5;
			gridBagConstraints4.gridy = 3;
			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
			gridBagConstraints2.gridx = 0;
			gridBagConstraints2.insets = new Insets(8, 10, 10, 8);
			gridBagConstraints2.gridy = 1;
			digitalHeaderLabel = new JLabel();
			digitalHeaderLabel.setText("Solicite ao candidato que coloque o dedo indicador três vezes no coletor de digitais");
			digitalPanel = new JPanel();
			digitalPanel.setLayout(new GridBagLayout());
			digitalPanel.add(digitalHeaderLabel, gridBagConstraints2);
			digitalPanel.add(getDigitaisPanel(), gridBagConstraints4);
			digitalPanel.add(getDigitalImagePanel(), gridBagConstraints7);
		}
		return digitalPanel;
	}
	
	/**
	 * This method initializes centerPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getInscricaoPanel() {
		if (inscricaoPanel == null) {
			GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
			gridBagConstraints17.gridx = 2;
			gridBagConstraints17.insets = new Insets(5, 8, 5, 8);
			gridBagConstraints17.gridy = 5;
			inscricaoNumberReadLabel = new JLabel();
			inscricaoNumberReadLabel.setText("Confira o número lido acima com o número do cartão resposta");
			GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
			gridBagConstraints15.gridx = 1;
			gridBagConstraints15.insets = new Insets(8, 0, 8, 0);
			gridBagConstraints15.gridwidth = 2;
			GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
			gridBagConstraints14.insets = new Insets(5, 5, 10, 0);
			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
			gridBagConstraints11.gridwidth = 2;
			gridBagConstraints11.gridy = 1;
			gridBagConstraints11.insets = new Insets(5, 5, 5, 8);
			gridBagConstraints11.gridx = 2;
			GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
			gridBagConstraints9.gridx = 2;
			gridBagConstraints9.gridwidth = 2;
			gridBagConstraints9.insets = new Insets(5, 0, 5, 0);
			gridBagConstraints9.gridy = 6;
			GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
			gridBagConstraints8.fill = GridBagConstraints.NONE;
			gridBagConstraints8.gridy = 4;
			gridBagConstraints8.weightx = 1.0;
			gridBagConstraints8.insets = new Insets(5, 0, 5, 8);
			gridBagConstraints8.anchor = GridBagConstraints.CENTER;
			gridBagConstraints8.gridx = 2;
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.gridx = 2;
			gridBagConstraints1.gridwidth = 2;
			gridBagConstraints1.insets = new Insets(5, 0, 5, 0);
			gridBagConstraints1.gridy = 2;
			inscricaoHeaderLabel = new JLabel();
			inscricaoHeaderLabel.setText("Posicione a o cartão do candidato em frente a câmera e pressione o botão abaixo");
			inscricaoPanel = new JPanel();
			inscricaoPanel.setLayout(new GridBagLayout());
			inscricaoPanel.add(getCameraPanel(), gridBagConstraints15);
			inscricaoPanel.add(inscricaoHeaderLabel, gridBagConstraints11);
			inscricaoPanel.add(getLerCodigoButton(), gridBagConstraints1);
			inscricaoPanel.add(getNumeroLidoField(), gridBagConstraints8);
			inscricaoPanel.add(getNumeroLidoOkButton(), gridBagConstraints9);
			inscricaoPanel.add(inscricaoNumberReadLabel, gridBagConstraints17);
		}
		return inscricaoPanel;
	}
	
	/**
	 * This method initializes centerPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getEtiquetaPanel() {
		if (etiquetaPanel == null) {
			GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
			gridBagConstraints12.gridx = 0;
			gridBagConstraints12.insets = new Insets(5, 0, 5, 0);
			gridBagConstraints12.gridy = 2;
			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
			gridBagConstraints10.gridx = 0;
			gridBagConstraints10.gridy = 0;
			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
			gridBagConstraints3.gridx = 0;
			gridBagConstraints3.gridy = 1;
			etiquetaHeaderLabel = new JLabel();
			etiquetaHeaderLabel.setText("Imprima a etiqueta com o código de barras utilizando o botão abaixo.");
			etiquetaPanel = new JPanel();
			etiquetaPanel.setLayout(new GridBagLayout());
			etiquetaPanel.add(etiquetaHeaderLabel, new GridBagConstraints());
			etiquetaPanel.add(getEtiquetaImagemPanel(), gridBagConstraints3);
			etiquetaPanel.add(getImprimirEtiquetaButton(), gridBagConstraints12);
		}
		return etiquetaPanel;
	}
	
	private ImagePanel getEtiquetaImagemPanel() {
		if (etiquetaImagemPanel == null) {
			etiquetaImagemPanel = new ImagePanel();
			etiquetaImagemPanel.setLayout(new GridBagLayout());
			etiquetaImagemPanel.setPreferredSize(new Dimension(250, 250));
			etiquetaImagemPanel.setMinimumSize(new Dimension(250, 250));
		}
		return etiquetaImagemPanel;
	}
	
	public void refresh() {
		State currentState = controller.getCurrentState();
		
		Object component = mainContentPane.getComponent(mainContentPane.getComponentCount() -1); //Como object para evitar que o VE renderize
		if (component == inscricaoPanel || component == digitalPanel || component == etiquetaPanel || component == fiscalPanel || component == aguardandoPanel) {
			mainContentPane.remove((Component)component);
		}
		
		if (currentState.equals(controller.AUTENTICANDO_FISCAL)) {
			mainContentPane.add(getFiscalPanel(), BorderLayout.CENTER);
		} else if (currentState.equals(controller.AGUARDANDO_CANDIDATO)) {
			mainContentPane.add(getAguardandoPanel(), BorderLayout.CENTER);
		} else if (currentState.equals(controller.COLETANDO_NUMERO_INSCRICAO)) {
			mainContentPane.add(getInscricaoPanel(), BorderLayout.CENTER);
		} else if (currentState.equals(controller.COLETANDO_DIGITAIS)) {
			mainContentPane.add(getDigitalPanel(), BorderLayout.CENTER);
		} else if (currentState.equals(controller.IMPRIMINDO_ETIQUETA)) {
			mainContentPane.add(getEtiquetaPanel(), BorderLayout.CENTER);
		}
		stepSlider.setValue(currentState.number);
		
		mainContentPane.validate();
		mainContentPane.repaint();
	}
	
	public void clearDigital() {
		getDigital1CheckBox().setSelected(false);
		getDigital2CheckBox().setSelected(false);
		getDigital3CheckBox().setSelected(false);
		getDigitalImagePanel().setImage(null);
	}
	
	public void reportLeituraDigitalDoCandidato(int num, boolean ok, Image fingerprint) {
		switch (num) {
		case 1:
			if (ok) {
				digital1CheckBox.setSelected(true);
			}
			break;
		case 2:
			if (ok) {
				digital2CheckBox.setSelected(true);
			}
			break;
		case 3:
			if (ok) {
				digital3CheckBox.setSelected(true);
			}
			break;

		default:
			break;
		}
		getDigitalImagePanel().setImage(fingerprint);
	}
	
	public void reportLeituraDigitalDoFiscal(int num, boolean ok, Image fingerprint, String nome) {
		switch (num) {
		case 1:
			if (ok) {
				digitalFiscal1CheckBox.setSelected(true);
				digitalFiscal1CheckBox.setText("Digital OK!");
				getFiscalIndentificadoTextField().setText(nome);
			}
			break;
		default:
			break;
		}
		getDigitalFiscalImagePanel().setImage(fingerprint);
	}

	public void showError(String message) {
		JOptionPane.showMessageDialog(this, message, "Erro", JOptionPane.ERROR_MESSAGE);
	}

	/**
	 * This method initializes lerCodigoButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getLerCodigoButton() {
		if (lerCodigoButton == null) {
			lerCodigoButton = new JButton();
			lerCodigoButton.setText(LER_CODIGO_DO_CARTAO);
			lerCodigoButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					Thread worker = new Thread() {
						public void run() {
							controller.leCodigoDoCartao();
						}
					};
					worker.start();
				}
			});
		}
		return lerCodigoButton;
	}

	/**
	 * This method initializes digitaisPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getDigitaisPanel() {
		if (digitaisPanel == null) {
			GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
			gridBagConstraints16.anchor = GridBagConstraints.WEST;
			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
			gridBagConstraints6.gridx = 0;
			gridBagConstraints6.anchor = GridBagConstraints.WEST;
			gridBagConstraints6.gridy = 2;
			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
			gridBagConstraints5.gridx = 0;
			gridBagConstraints5.anchor = GridBagConstraints.WEST;
			gridBagConstraints5.gridy = 1;
			digitaisPanel = new JPanel();
			digitaisPanel.setLayout(new GridBagLayout());
			digitaisPanel.add(getDigital1CheckBox(), gridBagConstraints16);
			digitaisPanel.add(getDigital2CheckBox(), gridBagConstraints5);
			digitaisPanel.add(getDigital3CheckBox(), gridBagConstraints6);
		}
		return digitaisPanel;
	}

	/**
	 * This method initializes digital1CheckBox	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getDigital1CheckBox() {
		if (digital1CheckBox == null) {
			digital1CheckBox = new JCheckBox();
			digital1CheckBox.setText("Primeira Amostra");
			digital1CheckBox.setFont(new Font("Arial", Font.BOLD, 16));
			digital1CheckBox.setIcon(Icons.FINGEPRINT_GRAY);
			digital1CheckBox.setSelectedIcon(Icons.FINGEPRINT_GREEN);
		}
		return digital1CheckBox;
	}

	/**
	 * This method initializes digital2CheckBox	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getDigital2CheckBox() {
		if (digital2CheckBox == null) {
			digital2CheckBox = new JCheckBox();
			digital2CheckBox.setText("Segunda Amostra");
			digital2CheckBox.setFont(new Font("Arial", Font.BOLD, 16));
			digital2CheckBox.setIcon(Icons.FINGEPRINT_GRAY);
			digital2CheckBox.setSelectedIcon(Icons.FINGEPRINT_GREEN);
		}
		return digital2CheckBox;
	}

	/**
	 * This method initializes digital3CheckBox	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getDigital3CheckBox() {
		if (digital3CheckBox == null) {
			digital3CheckBox = new JCheckBox();
			digital3CheckBox.setText("Terceira Amostra");
			digital3CheckBox.setFont(new Font("Arial", Font.BOLD, 16));
			digital3CheckBox.setIcon(Icons.FINGEPRINT_GRAY);
			digital3CheckBox.setSelectedIcon(Icons.FINGEPRINT_GREEN);
		}
		return digital3CheckBox;
	}

	public void reportReadCardNumber(Integer cardNumber, int nDigitos) {

		NumberFormat nf = NumberFormat.getInstance();
		nf.setMinimumIntegerDigits(7);
		nf.setGroupingUsed(false);
		
		numeroLidoField.setText(nf.format(cardNumber));
		
		lerCodigoButton.setText("Reler código do cartão");
		lerCodigoButton.setEnabled(true);
		numeroLidoOkButton.setEnabled(true);
	}
	
	public void reportReadCardNumberError(String error) {
		showError(error);
		lerCodigoButton.setEnabled(true);
	}
	
	public void clearCardNumber() {
		getNumeroLidoField().setText("");
		getNumeroLidoOkButton().setEnabled(false);
		getLerCodigoButton().setText(LER_CODIGO_DO_CARTAO);
		
	}
	
	public void reportGeneratedQRCode(BufferedImage qrCodeImage) {
		getEtiquetaImagemPanel().setImage(qrCodeImage);
	}

	/**
	 * This method initializes numeroLidoField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getNumeroLidoField() {
		if (numeroLidoField == null) {
			numeroLidoField = new JTextField(8);
			numeroLidoField.setEditable(false);
			numeroLidoField.setFont(new Font(null, Font.BOLD, 16));
		}
		return numeroLidoField;
	}

	/**
	 * This method initializes numeroLidoOkButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getNumeroLidoOkButton() {
		if (numeroLidoOkButton == null) {
			numeroLidoOkButton = new JButton();
			numeroLidoOkButton.setText("Número OK");
			numeroLidoOkButton.setEnabled(false);
			numeroLidoOkButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					Thread worker = new Thread() {
						public void run() {
							controller.colherDigitais();
						}
					};
					worker.start();
				}
			});
		}
		return numeroLidoOkButton;
	}

	/**
	 * This method initializes imprimirEtiquetaButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getImprimirEtiquetaButton() {
		if (imprimirEtiquetaButton == null) {
			imprimirEtiquetaButton = new JButton();
			imprimirEtiquetaButton.setText("Imprimir Etiqueta");
			imprimirEtiquetaButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					controller.imprimeEtiqueta();
				}
			});
		}
		return imprimirEtiquetaButton;
	}

	/**
	 * This method initializes jCameraPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	public ImagePanel getCameraPanel() {
		if (cameraPanel == null) {
			cameraPanel = new ImagePanel();
			cameraPanel.setLayout(new GridBagLayout());
			cameraPanel.setPreferredSize(new Dimension(320, 240));
			cameraPanel.setMinimumSize(new Dimension(320, 240));
		}
		return cameraPanel;
	}

	/**
	 * This method initializes fingerprintPanel	
	 * 	
	 * @return ufrj.safcp.view.components.ImagePanel	
	 */
	private ImagePanel getDigitalImagePanel() {
		if (digitalImagePanel == null) {
			digitalImagePanel = new ImagePanel();
			digitalImagePanel.setLayout(new GridBagLayout());
			digitalImagePanel.setMinimumSize(new Dimension(240, 320));
			digitalImagePanel.setPreferredSize(new Dimension(240, 320));
		}
		return digitalImagePanel;
	}

	/**
	 * This method initializes fiscalPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getFiscalPanel() {
		if (fiscalPanel == null) {
			GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
			gridBagConstraints71.insets = new Insets(8, 0, 8, 0);
			gridBagConstraints71.gridy = 0;
			gridBagConstraints71.gridx = 0;
			GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
			gridBagConstraints41.insets = new Insets(12, 0, 12, 0);
			gridBagConstraints41.gridy = 3;
			gridBagConstraints41.ipadx = 5;
			gridBagConstraints41.ipady = 5;
			gridBagConstraints41.gridx = 0;
			GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
			gridBagConstraints21.insets = new Insets(8, 10, 10, 8);
			gridBagConstraints21.gridy = 1;
			gridBagConstraints21.gridx = 0;
			fiscalHeaderLabel = new JLabel();
			fiscalHeaderLabel.setText("Coloque o dedo no coletor de digitais para entrada no sistema");
			fiscalPanel = new JPanel();
			fiscalPanel.setLayout(new GridBagLayout());
			fiscalPanel.add(fiscalHeaderLabel, gridBagConstraints21);
			fiscalPanel.add(getDigitaisFiscalPanel(), gridBagConstraints41);
			fiscalPanel.add(getDigitalFiscalImagePanel(), gridBagConstraints71);
		}
		return fiscalPanel;
	}

	/**
	 * This method initializes digitaisFiscalPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getDigitaisFiscalPanel() {
		if (digitaisFiscalPanel == null) {
			GridBagConstraints gridBagConstraints161 = new GridBagConstraints();
			gridBagConstraints161.anchor = GridBagConstraints.WEST;
			digitaisFiscalPanel = new JPanel();
			digitaisFiscalPanel.setLayout(new GridBagLayout());
			digitaisFiscalPanel.add(getDigitalFiscal1CheckBox(), gridBagConstraints161);
		}
		return digitaisFiscalPanel;
	}

	/**
	 * This method initializes digitalFiscal1CheckBox	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getDigitalFiscal1CheckBox() {
		if (digitalFiscal1CheckBox == null) {
			digitalFiscal1CheckBox = new JCheckBox();
			digitalFiscal1CheckBox.setFont(new Font("Arial", Font.BOLD, 16));
			digitalFiscal1CheckBox.setSelectedIcon(Icons.FINGEPRINT_GREEN);
			digitalFiscal1CheckBox.setText("Aguardando Digital");
			digitalFiscal1CheckBox.setIcon(Icons.FINGEPRINT_GRAY);
		}
		return digitalFiscal1CheckBox;
	}

	/**
	 * This method initializes fingerprintFiscalPanel	
	 * 	
	 * @return ufrj.safcp.view.components.ImagePanel	
	 */
	private ImagePanel getDigitalFiscalImagePanel() {
		if (digitalFiscalImagePanel == null) {
			digitalFiscalImagePanel = new ImagePanel();
			digitalFiscalImagePanel.setLayout(new GridBagLayout());
			digitalFiscalImagePanel.setMinimumSize(new Dimension(240, 320));
			digitalFiscalImagePanel.setPreferredSize(new Dimension(240, 320));
		}
		return digitalFiscalImagePanel;
	}

	/**
	 * This method initializes aguardandoPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getAguardandoPanel() {
		if (aguardandoPanel == null) {
			GridBagConstraints gridBagConstraints121 = new GridBagConstraints();
			gridBagConstraints121.insets = new Insets(5, 0, 5, 0);
			gridBagConstraints121.gridy = 2;
			gridBagConstraints121.gridx = 0;
			aguardandoHeaderLabel = new JLabel();
			aguardandoHeaderLabel.setText("Aguarde a chegada do candidato e pressione o botão prosseguir.");
			aguardandoPanel = new JPanel();
			aguardandoPanel.setLayout(new GridBagLayout());
			aguardandoPanel.add(aguardandoHeaderLabel, new GridBagConstraints());
			aguardandoPanel.add(getProsseguirButton(), gridBagConstraints121);
		}
		return aguardandoPanel;
	}

	/**
	 * This method initializes prosseguirButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getProsseguirButton() {
		if (prosseguirButton == null) {
			prosseguirButton = new JButton();
			prosseguirButton.setText("Prosseguir");
			prosseguirButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					controller.prossegueParaColetas();
				}
			});
		}
		return prosseguirButton;
	}

	/**
	 * This method initializes rodapePanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getRodapePanel() {
		if (rodapePanel == null) {
			fiscalLabel = new JLabel();
			fiscalLabel.setText("Fiscal autenticado:");
			rodapePanel = new JPanel();
			rodapePanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
			rodapePanel.add(fiscalLabel, null);
			rodapePanel.add(getFiscalIndentificadoTextField(), null);
		}
		return rodapePanel;
	}

	/**
	 * This method initializes fiscalIndentificadoTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getFiscalIndentificadoTextField() {
		if (fiscalIndentificadoTextField == null) {
			fiscalIndentificadoTextField = new JTextField(30);
			fiscalIndentificadoTextField.setFont(new Font(null, Font.BOLD, 16));
			fiscalIndentificadoTextField.setEditable(false);
		}
		return fiscalIndentificadoTextField;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
